package com.guonl.controller;

import com.guonl.annotations.SignatureValidation;
import com.guonl.controller.model.UserInfo;
import com.guonl.model.ResponseResult;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/openapi")
public class OpenApiController {

    @SignatureValidation
    @GetMapping("/getTest1")
    public ResponseResult getTest1(String name, Integer age, String phone) {
        UserInfo userInfo = new UserInfo();
        userInfo.setName(name);
        userInfo.setAge(age);
        userInfo.setPhone(phone);
        return ResponseResult.ok(userInfo);
    }

    @SignatureValidation
    @GetMapping("/getTest2")
    public ResponseResult getTest2(UserInfo userInfo) {
        return ResponseResult.ok(userInfo);
    }

    @SignatureValidation
    @PostMapping("/postTest1")
    public ResponseResult postTest1(UserInfo userInfo) {
        return ResponseResult.ok(userInfo);
    }

    @SignatureValidation
    @PostMapping("/postTest2")
    public ResponseResult postTest2(@RequestBody UserInfo userInfo) {
        return ResponseResult.ok(userInfo);
    }


}
